﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="User_Add.aspx.cs" MasterPageFile="~/Admin/Admin.Master"
    Inherits="TimKen.Web.Admin.UserAccount.User_Add" %>

<asp:Content ContentPlaceHolderID="ContentTitle" ID="title" runat="server">
    <%=GetLangString("TypeName")%> 
</asp:Content>
<asp:Content ContentPlaceHolderID="ContentLinkAction" ID="links" runat="server">
    <span class="action-span"><a href="User_List.aspx">
    <%=GetLangString("UserAccountInfo")%></a></span>
</asp:Content>
<asp:Content ContentPlaceHolderID="ContentMain" ID="content" runat="server">

<script  type="text/javascript">
    function changeType() {
        var selectedindex = document.getElementById("<%=dplRole.ClientID%>").selectedIndex;

        if (selectedindex != 1 && selectedindex != 2) {
            document.getElementById("tr1").style.display = "none";
            document.getElementById("<%=dplCompanyID.ClientID%>").value = "-1";
            document.getElementById("SelectUser").style.display = "none";
            
        }
        else {
            document.getElementById("tr1").style.display = "";
            document.getElementById("SelectUser").style.display = "inline";
            
        }
    }
    
    
</script>


    <div class="main-div">
        <table id="general-table">
 
            <tr>
                <th class="label">
                    <%=GetLangString("TypeName")%>：
                </th>
                <td>
                    <asp:DropDownList ID="dplRole" runat="server" onchange="changeType()">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr id="tr1" >
                <th class="label">
                     <%=GetLangString("CustomerName")%>：
                </th>
                <td>
                    <asp:DropDownList ID="dplCompanyID" runat="server"   >
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("UserName")%>：
                </th>
                <td>
                    <asp:TextBox ID="txtUserName"  runat="server"></asp:TextBox>
                    <span id="SelectUser"><asp:LinkButton ID="lbtSelectUser" runat="server" onclick="lbtSelectUser_Click"><%=GetLangString("SelectWebUser") %></asp:LinkButton></span>
                </td>
                
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("InitialPassword")%>：
                </th>
                <td>
                    <asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("RealName")%>：
                </th>
                <td>
                    <asp:TextBox ID="txtRealName" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("Telephone")%>：
                </th>
                <td>
                    <asp:TextBox ID="txtPhone" runat="server"></asp:TextBox>
                </td>
            </tr>
            
            
            <tr>
                <th class="label">
                   <%=GetLangString("Email")%>：
                </th>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                </td>
            </tr>
            
            
            <asp:Panel   ID="panelPoints"  runat="server"  Visible="false">
              <tr>
                <th class="label">
                   积分：
                </th>
                <td>
                    <asp:TextBox ID="txtPoints" runat="server"  Text="0"></asp:TextBox>
                </td>
            </tr>
            </asp:Panel>

            <tr>
                <th class="label">
                </th>
                <td>
                    <asp:Button ID="btnSave" runat="server" CssClass="button" UseSubmitBehavior="False"
                        OnClick="btnSave_Click" />
               
                </td>
            </tr>
            <tr>
                <td colspan="2">
                </td>
            </tr>
        </table>
        <div  runat="server" id="WebUser">
                <img src="../images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
        <!-- 账号 -->
        <%=GetLangString("UserName")%>：<asp:TextBox ID="txtWebUserName" runat="server"></asp:TextBox>
        <!-- 真实姓名 -->
        <%=GetLangString("RealName")%>：<asp:TextBox ID="txtWebRealName" runat="server"></asp:TextBox>
        <!-- 公司 -->
        <%=GetLangString("Company")%>：<asp:TextBox ID="txtCompany" runat="server"></asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" CssClass="button" OnClick="btnSearch_Click" />
               <asp:GridView ID="grdWebUser" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="UserName" OnRowCommand="grdWebUser_RowCommand" CssClass="grid">
            <Columns>
                <asp:TemplateField>
                    <ItemStyle Width="80" />
                    <HeaderTemplate>
                        <%=GetLangString("UserName")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("UserName")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="80" />
                    <HeaderTemplate>
                        <%=GetLangString("NickName")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("NickName")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="100" />
                    <HeaderTemplate>
                        <%=GetLangString("RealName")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("RealName")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="150" />
                    <HeaderTemplate>
                        <%=GetLangString("Company")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("Company")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="160" />
                    <HeaderTemplate>
                        <%=GetLangString("Telephone")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("Phone")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="160" />
                    <HeaderTemplate>
                        <%=GetLangString("Email")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <%#Eval("Email")%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemStyle Width="80" HorizontalAlign="Center" />
                    <HeaderTemplate>
                        <%=GetLangString("Operation")%>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="btnSelect" runat="server" ToolTip='<%#GetLangString("Select")%>'
                            CommandName="SelectEvent" CommandArgument='<%#Eval("UserName")%>'  
                            Text='<%#GetLangString("Select")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <HeaderStyle HorizontalAlign="Center" />
        </asp:GridView>
        <div class="pager-div">
            <ux:AspNetPager ID="AspNetPager1" runat="server" Width="100%" ShowPageIndexBox="Always"
                HorizontalAlign="right" EnableTheming="true" AlwaysShow="true" PageIndexBoxType="DropDownList"
                OnPageChanged="AspNetPager1_PageChanged" ImagePath="/images/" 
                        NavigationButtonType="Image" ButtonImageNameExtension="n" 
                        CpiButtonImageNameExtension="r" PagingButtonType="Image">
            </ux:AspNetPager>
        </div>
        </div>
    </div>
    
    <script  type="text/javascript">
        changeType();
    </script>
</asp:Content>
